<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:info:edit')}]];
    var prefix = ctx + "system/task";

    $(function() {
        var options = {
            url: prefix + "/intees",
            releaseUrl: prefix +"/release",
            modalName: "",
            columns: [
                {
                    field : 'deptName',
                    title : '名称'
                },
               {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="choice(\'' + row.deptId + '\')"><i class="fa fa-edit"></i>选择</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function choice(deptId) {
        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: prefix +"/choice",//url
            data:{"deptId":deptId},
            cache: false,
            success:function (data) {           //成功回调
                $(parent.$("#deptName")).attr("value",data.deptName);
                $(parent.$("#dId")).attr("value",data.deptId);
                setTimeout(function(){
                    $.modal.close();
                },300);
            }
        })
    }
    function submitHandler() {
        if ($.validate.form()) {
            choice()
        }
    }
</script>
</body>
</html>